<template>
  <div class="form-preview">

    <ex-form-render ref="vFormRenderRef" style="height: 100%;" :widget-list="state.widgetList"
      :form-config="state.formConfig" />
   
    <div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue';
import { useRoute } from 'vue-router';
const route = useRoute();

const state = reactive({
  widgetList: <any>[],
  formConfig: <any>{},
  formId: <any>null
})
const vFormRenderRef = ref();
const getFormData = () => {
  let data = vFormRenderRef.value.formData;
  console.log(data)
}
const getRouteId = () => {
  let id = route.query.id
  if (id) {
    let paramsData = <any>route.query
    let form = JSON.parse(paramsData?.formData)
    console.log(form)
    state.formId = id
    state.formConfig = form.formConfig
    state.widgetList = form.widgetList
  }
  console.log(state)

}
console.log(uni)
getRouteId()

</script>


<style scoped lang="scss">
.form-preview {
  height: 100%;
  width: 100%;
  position: relative;
}
</style>